import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Point;
import java.awt.image.BufferedImage;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import org.rsbot.event.listeners.PaintListener;
import org.rsbot.script.Script;
import org.rsbot.script.ScriptManifest;
import org.rsbot.script.methods.Calculations;
import org.rsbot.script.methods.Camera;
import org.rsbot.script.methods.Combat;
import org.rsbot.script.methods.Game;
import org.rsbot.script.methods.Interfaces;
import org.rsbot.script.methods.Inventory;
import org.rsbot.script.methods.Menu;
import org.rsbot.script.methods.Mouse;
import org.rsbot.script.methods.Objects;
import org.rsbot.script.methods.Players;
import org.rsbot.script.methods.Skills;
import org.rsbot.script.methods.Walking;
import org.rsbot.script.wrappers.RSArea;
import org.rsbot.script.wrappers.RSComponent;
import org.rsbot.script.wrappers.RSItem;
import org.rsbot.script.wrappers.RSObject;
import org.rsbot.script.wrappers.RSPlayer;
import org.rsbot.script.wrappers.RSTile;

@ScriptManifest(authors={"Voltrex"}, name="Voltrex Ape Atoll Agility", version=1.35D, description="Trains at Ape Atoll; eats all food, and cuts pineapples if you have a knife.")
public class VoltrexApeAtoll extends Script
  implements PaintListener
{
  private final ScriptManifest properties;
  private final int pineapple = 2114;
  private final int knife = 946;
  private final int[] dropItems;
  private final int[] food;
  private long scriptStartTime;
  private int runEnergy;
  private boolean setAltitude;
  private final VoltrexApeAtoll.Antibans antibans;
  private int startXP;
  private int startLvl;
  private int laps;
  private boolean lapStarted;
  private String status;
  private Image BKG;
  private BufferedImage normal;
  private BufferedImage clicked;
  private boolean waitGUI;
  VoltrexApeAtoll.ApeAtollGUI gui;
  private boolean safeLogOut;
  private boolean pickFruits;
  private boolean checkUpdates;
  private int MouseSpeed;

  public VoltrexApeAtoll()
  {
    this.properties = ((ScriptManifest)getClass().getAnnotation(ScriptManifest.class));
    this.pineapple = 2114;
    this.knife = 946;
    this.dropItems = new int[] { 2313, 1923 };
    this.food = new int[] { 1895, 1893, 1891, 4293, 2142, 291, 2140, 3228, 9980, 7223, 6297, 6293, 6295, 6299, 7521, 9988, 7228, 2878, 7568, 2343, 1861, 13433, 315, 325, 319, 3144, 347, 355, 333, 339, 351, 329, 3381, 361, 10136, 5003, 379, 365, 373, 7946, 385, 397, 391, 3369, 3371, 3373, 2309, 2325, 2333, 2327, 2331, 2323, 2335, 7178, 7180, 7188, 7190, 7198, 7200, 7208, 7210, 7218, 7220, 2003, 2011, 2289, 2291, 2293, 2295, 2297, 2299, 2301, 2303, 1891, 1893, 1895, 1897, 1899, 1901, 7072, 7062, 7078, 7064, 7084, 7082, 7066, 7068, 1942, 6701, 6703, 7054, 6705, 7056, 7060, 2130, 1985, 1993, 1989, 1978, 5763, 5765, 1913, 5747, 1905, 5739, 1909, 5743, 1907, 1911, 5745, 2955, 5749, 5751, 5753, 5755, 5757, 5759, 5761, 2084, 2034, 2048, 2036, 2217, 2213, 2205, 2209, 2054, 2040, 2080, 2277, 2225, 2255, 2221, 2253, 2219, 2281, 2227, 2223, 2191, 2233, 2092, 2032, 2074, 2030, 2281, 2235, 2064, 2028, 2187, 2185, 2229, 6883, 1971, 4608, 1883, 1885, 15272, 2118, 2116 };

    this.scriptStartTime = 0L;
    this.runEnergy = random(40, 95);
    this.setAltitude = true;
    this.antibans = new VoltrexApeAtoll.Antibans(this, null);

    this.startXP = 0;
    this.startLvl = 0;
    this.laps = 0;

    this.status = "";

    this.normal = null;
    this.clicked = null;

    this.waitGUI = true;
  }

  private VoltrexApeAtoll.State getState()
  {
    if ((this.inventory.contains(946)) && (this.inventory.contains(2114)) && (this.inventory.getCount() <= 24)) {
      return VoltrexApeAtoll.State.cutpineapple;
    }
    if ((this.pickFruits) && (this.inventory.getCount() < 28) && (this.inventory.contains(946)) && (this.inventory.getCount(this.food) < 4)) if (!new RSArea(new RSTile(2764, 2737), new RSTile(2779, 2752)).contains(new RSTile[] { this.players.getMyPlayer().getLocation() })) { if (!new RSArea(new RSTile(2755, 2742), new RSTile(2768, 2756)).contains(new RSTile[] { this.players.getMyPlayer().getLocation() })); } else if (this.game.getPlane() != 2)
      {
        return VoltrexApeAtoll.State.getpineapple;
      }
    if ((this.safeLogOut) && (this.combat.getLifePoints() < 150) && (!this.inventory.containsOneOf(this.food))) {
      this.log.info("Health is too low and out of food...");
      this.log.info("Health (" + this.combat.getLifePoints() + " hp) percentage remaining: " + this.combat.getHealth() + "%. Logged out to prevent dieing.");
      return VoltrexApeAtoll.State.error;
    }
    if ((this.players.getMyPlayer().getLocation().equals(new RSTile(2755, 2742))) || (this.players.getMyPlayer().getLocation().equals(new RSTile(2756, 2742))))
      return VoltrexApeAtoll.State.stone;
    if ((this.players.getMyPlayer().getLocation().equals(new RSTile(2753, 2742))) && (this.game.getPlane() != 2))
      return VoltrexApeAtoll.State.tree1;
    if (new RSArea(new RSTile(2752, 2741), new RSTile(2754, 2742)).contains(new RSTile[] { this.players.getMyPlayer().getLocation() }))
      return VoltrexApeAtoll.State.bars;
    if (this.players.getMyPlayer().getLocation().equals(new RSTile(2747, 2741)))
      return VoltrexApeAtoll.State.rocks;
    if (!this.players.getMyPlayer().getLocation().equals(new RSTile(2742, 2741))) { if (!new RSArea(new RSTile(2747, 2729), new RSTile(2752, 2736)).contains(new RSTile[] { this.players.getMyPlayer().getLocation() })); } else return VoltrexApeAtoll.State.rope;
    if (new RSArea(new RSTile(2756, 2730), new RSTile(2759, 2737)).contains(new RSTile[] { this.players.getMyPlayer().getLocation() }))
      return VoltrexApeAtoll.State.tree2;
    if (this.calc.distanceTo(new RSTile(2770, 2747)) > 3)
      return VoltrexApeAtoll.State.tostart;
    return VoltrexApeAtoll.State.recover1;
  }

  public boolean onStart()
  {
    log("Starting up, this may take a minute...");

    this.gui = new VoltrexApeAtoll.ApeAtollGUI(this);
    this.gui.setVisible(true);
    while (this.waitGUI) {
      sleep(100);
    }

    URLConnection localURLConnection = null;
    BufferedReader localBufferedReader = null;
    BufferedWriter localBufferedWriter = null;
    Object localObject;
    if (this.checkUpdates) {
      try
      {
        localURLConnection = new URL("http://www.voltrex.be/rsbot/VoltrexApeAtollVERSION.txt").openConnection();

        localBufferedReader = new BufferedReader(new InputStreamReader(localURLConnection.getInputStream()));

        if (Double.parseDouble(localBufferedReader.readLine()) > this.properties.version())
        {
          if (JOptionPane.showConfirmDialog(null, "Update found. Do you want to update?") == 0)
          {
            JOptionPane.showMessageDialog(null, "Please choose 'VoltrexApeAtoll.java' in your scripts/sources folder.");

            JFileChooser localJFileChooser = new JFileChooser();

            if (localJFileChooser.showOpenDialog(null) == 0)
            {
              localURLConnection = new URL("http://www.voltrex.be/rsbot/VoltrexApeAtoll.java").openConnection();

              localBufferedReader = new BufferedReader(new InputStreamReader(localURLConnection.getInputStream()));

              localBufferedWriter = new BufferedWriter(new FileWriter(localJFileChooser.getSelectedFile().getPath()));

              while ((localObject = localBufferedReader.readLine()) != null) {
                localBufferedWriter.write((String)localObject);
                localBufferedWriter.newLine();
                localBufferedWriter.flush();
              }

              log("Script successfully downloaded. Please recompile.");
              return false;
            }
            log("Update canceled");
          } else {
            log("Update canceled");
          }
        }
        else log("You have the latest version.");

        if (localBufferedReader != null)
          localBufferedReader.close();
        if (localBufferedWriter != null)
          localBufferedWriter.close();
      } catch (IOException localIOException1) {
        log("Problem getting version. Please report this bug!");
      }

    }

    try
    {
      this.BKG = ImageIO.read(new URL("http://i54.tinypic.com/2egcfaw.jpg"));
    } catch (IOException localIOException2) {
      localIOException2.printStackTrace();
    }
    try
    {
      URL localURL = new URL("http://imgur.com/i7nMG.png");
      localObject = new URL("http://imgur.com/8k9op.png");
      this.normal = ImageIO.read(localURL);
      this.clicked = ImageIO.read((URL)localObject);
    } catch (MalformedURLException localMalformedURLException) {
      this.log.info("Unable to buffer cursor.");
    } catch (IOException localIOException3) {
      this.log.info("Unable to open cursor image.");
    }
    this.scriptStartTime = System.currentTimeMillis();
    this.mouse.setSpeed(this.MouseSpeed);
    this.camera.setPitch(true);

    log("You are using Voltrex Ape Atoll agility course.");

    return true;
  }

  public int loop()
  {
    if (!this.game.isLoggedIn()) {
      sleep(1400);
      logIn();
      return random(100, 200);
    }

    if (this.startLvl == 0) {
      this.startXP = this.skills.getCurrentExp(16);
      this.startLvl = this.skills.getCurrentLevel(16);
      return 50;
    }

    if (this.setAltitude) {
      this.camera.setPitch(true);
      sleep(random(250, 500));
      this.setAltitude = false;
      return 50;
    }
    this.camera.setPitch(true);

    eat();

    startRunning(this.runEnergy);

    if (this.inventory.containsOneOf(this.dropItems)) {
      while (this.inventory.containsOneOf(this.dropItems)) {
        this.inventory.getItem(this.dropItems).doAction("Drop");
      }
    }

    if (this.players.getMyPlayer().getLocation().equals(new RSTile(2752, 2736))) {
      walkTile(new RSTile(2751, 2731));
    }

    switch (VoltrexApeAtoll.1.$SwitchMap$VoltrexApeAtoll$State[getState().ordinal()]) {
    case 1:
      doStone();
      return 50;
    case 2:
      doTree1();
      return 50;
    case 3:
      doBars();
      return 50;
    case 4:
      doRocks();
      return 50;
    case 5:
      doRope();
      return 50;
    case 6:
      doTree2();
      return 50;
    case 7:
      doTostart();
      return 50;
    case 8:
      doRecover1();
      return 50;
    case 9:
      doGetpineapple();
      return 50;
    case 10:
      doCutpineapple();
      return 50;
    case 11:
      return -1;
    }

    return 50;
  }

  private void doStone()
  {
    this.status = "Jumping on stone...";

    this.lapStarted = true;

    RSTile localRSTile = new RSTile(2754, 2742);

    if ((this.calc.tileOnScreen(localRSTile)) && 
      (onTile(localRSTile, "Stepping stone", "Jump-to", 0.5D, 0.4D, 0))) {
      VoltrexApeAtoll.Antibans.access$100(this.antibans, new int[] { 4 }, random(11, 18));
      sleep(random(500, 700));
      if (!this.players.getMyPlayer().getLocation().equals(new RSTile(2755, 2742))) {
        sleep(random(700, 1500));
      }

    }

    while ((this.players.getMyPlayer().getAnimation() == 3481) || (this.players.getMyPlayer().isMoving()))
      sleep(100);
  }

  private void doTree1() {
    this.status = "Climbing tree...";
    RSTile localRSTile = new RSTile(2752, 2741);
    if (onTile(localRSTile, "Tropical tree", "Climb", 0.5D, 0.4D, 0))
      sleep(random(100, 200));
    this.camera.setAngle(random(1, 360));
    sleep(random(100, 300));
    this.mouse.move(random(50, 700), random(50, 450), 2, 2);
    sleep(random(200, 700));
    this.mouse.move(random(50, 700), random(50, 450), 2, 2);
    sleep(random(1800, 2100));
    while ((this.players.getMyPlayer().isMoving()) || (this.players.getMyPlayer().getAnimation() == 3487))
      sleep(100);
  }

  private void doBars() {
    this.status = "Crossing bars...";
    RSObject localRSObject = this.objects.getNearest(new int[] { 12573 });

    if (localRSObject != null) {
      localRSObject.doAction("Swing Across");
      sleep(random(1000, 1500));
    }

    while ((this.players.getMyPlayer().getAnimation() == 3484) || (this.players.getMyPlayer().isMoving()))
      sleep(100);
  }

  private void doRocks() {
    this.status = "Climbing rocks...";
    this.camera.setPitch(true);

    RSObject localRSObject = this.objects.getNearest(new int[] { 12576 });
    RSTile localRSTile = new RSTile(2747, 2741);

    if (localRSObject != null)
    {
      while (!localRSObject.doAction("Climb-up")) {
        localRSObject.doAction("Climb-up");
        sleep(random(200, 400));
      }
      sleep(random(500, 700));

      if (this.players.getMyPlayer().getLocation().equals(localRSTile)) {
        this.camera.setAngle(random(1, 360));
      } else {
        int i = random(1, 2);
        if (i == 1)
          this.mouse.move(random(50, 700), random(50, 450), 2, 2);
        else {
          this.camera.setAngle(random(1, 360));
        }
        sleep(random(1400, 1700));
      }

    }

    while ((this.players.getMyPlayer().getAnimation() == 3484) || (this.players.getMyPlayer().isMoving()))
      sleep(100);
  }

  private void doRope() {
    RSTile localRSTile1 = new RSTile(2752, 2731);

    RSTile localRSTile2 = new RSTile(2751, 2731);

    if (this.players.getMyPlayer().getAnimation() != 3488) {
      if (!new RSArea(new RSTile(2749, 2730), new RSTile(2751, 2733)).contains(new RSTile[] { this.players.getMyPlayer().getLocation() })) {
        this.status = "Walking to rope...";
        walkTile(localRSTile2);
        this.mouse.move(random(220, 340), random(130, 200), 2, 2);
        VoltrexApeAtoll.Antibans.access$100(this.antibans, new int[] { 1 }, random(13, 20));
        sleep(random(200, 400));
      }
      else if (this.calc.tileOnScreen(localRSTile1)) {
        if (onTile(localRSTile1, "Rope", "Swing", 0.5D, 0.6D, 0)) {
          this.status = "Swinging rope...";
          sleep(random(50, 200));
          this.camera.setAngle(random(1, 70));
          this.mouse.move(random(330, 422), random(95, 122), 2, 2);
          sleep(random(100, 400));
        } else {
          this.camera.setAngle(this.camera.getAngle() + random(-70, 70));
          return;
        }
      } else {
        this.camera.setAngle(this.camera.getAngle() + random(-50, 50));
      }

    }

    while ((this.players.getMyPlayer().isMoving()) || (this.players.getMyPlayer().getAnimation() == 3488))
      sleep(100);
  }

  private void doTree2() {
    this.status = "Climbing down tree...";

    RSTile localRSTile = new RSTile(2757, 2734);

    if (this.game.getPlane() != 1) {
      if (this.calc.tileOnScreen(localRSTile)) {
        if (onTile(localRSTile, "Tropical tree", "Climb-down", 0.5D, 0.4D, 0)) {
          if (this.lapStarted) {
            this.laps += 1;
            this.lapStarted = false;
          }
          VoltrexApeAtoll.Antibans.access$100(this.antibans, new int[] { 2 }, random(11, 17));
          sleep(random(300, 500));
          this.mouse.move(random(550, 670), random(20, 120), 2, 2);
          sleep(random(800, 1500));
        } else {
          this.camera.setAngle(random(1, 70));
        }
      }
      else this.camera.setAngle(this.camera.getAngle() + random(-70, 70)); 
    }
    else
    {
      VoltrexApeAtoll.Antibans.access$100(this.antibans, new int[] { 2 }, random(11, 17));
      sleep(random(300, 500));
      this.camera.setAngle(this.camera.getAngle() + random(-70, 70));
    }

    while (this.players.getMyPlayer().isMoving())
      sleep(100);
  }

  private void doRecover1() {
    this.status = "Walking to start...";

    RSTile[] arrayOfRSTile = { new RSTile(2768, 2747), new RSTile(2755, 2742) };

    if (this.players.getMyPlayer().getLocation() != arrayOfRSTile[1]) {
      this.walking.walkPathMM(arrayOfRSTile, 1, 1);

      sleep(random(500, 750));
    }

    while (this.players.getMyPlayer().isMoving())
      sleep(100);
  }

  private void doTostart() {
    this.status = "Walking to start... (2)";

    RSTile[] arrayOfRSTile = { new RSTile(2768, 2747), new RSTile(2755, 2742) };

    if (this.players.getMyPlayer().getLocation().equals(new RSTile(2756, 2743))) {
      walkTile(new RSTile(2755, 2742));
      sleep(random(500, 750));
    } else if (this.players.getMyPlayer().getLocation() != arrayOfRSTile[1]) {
      this.walking.walkPathMM(arrayOfRSTile, 1, 1);

      sleep(random(500, 750));
    }

    while (this.players.getMyPlayer().isMoving())
      sleep(100);
  }

  private void doCutpineapple() {
    this.status = "Cutting pineapples... (1)";

    this.status = "Cutting pineapples... (2)";
    RSItem localRSItem1 = this.inventory.getItem(new int[] { 946 });
    RSItem localRSItem2 = this.inventory.getItem(new int[] { 2114 });
    this.inventory.useItem(localRSItem1, localRSItem2);
    sleep(random(500, 600));

    if (this.interfaces.getComponent(905, 14).isValid()) {
      this.status = "Cutting pineapples... (3)";
      this.interfaces.getComponent(905, 14).doClick();
      sleep(random(800, 1000));
    }

    eat();
  }

  private void doGetpineapple() {
    RSTile localRSTile1 = new RSTile(2774, 2748);
    RSTile localRSTile2 = new RSTile(2768, 2747);

    if ((this.calc.distanceTo(localRSTile1) > 3) && (this.calc.tileOnMap(localRSTile1))) {
      this.status = "Walking to plant...";
      walkTile(localRSTile1);
      sleep(random(500, 750));
    } else if (!this.calc.tileOnMap(localRSTile1)) {
      this.status = "Walking to pineapples...";
      walkTile(localRSTile2);
      sleep(random(500, 750));
    } else {
      this.status = "Collecting pineapple...";
      RSObject localRSObject = this.objects.getNearest(new int[] { 4827 });

      if (localRSObject != null) {
        localRSObject.doAction("Pick");
        sleep(random(800, 1200));
      } else {
        this.status = "Waiting for pineapple...";
      }
    }

    while (this.players.getMyPlayer().isMoving())
      sleep(100);
  }

  private void startRunning(int paramInt) {
    if ((this.walking.getEnergy() >= paramInt) && (!this.walking.isRunEnabled())) {
      this.runEnergy = random(40, 95);
      this.walking.setRun(true);
      sleep(random(500, 750));
    }
  }

  public boolean eat() {
    int i = this.combat.getLifePoints();
    int j = this.skills.getRealLevel(3) * 10;
    if ((this.inventory.containsOneOf(this.food)) && 
      (i <= random(j / 2.0D, j / 2.5D))) {
      this.status = "Eating...";
      this.inventory.getItem(this.food).doAction("Eat");
      sleep(300, 500);
    }

    return false;
  }

  public boolean onTile(RSTile paramRSTile, String paramString1, String paramString2, double paramDouble1, double paramDouble2, int paramInt)
  {
    Point localPoint1 = this.calc.tileToScreen(paramRSTile, paramDouble1, paramDouble2, paramInt);
    if (!this.calc.pointOnScreen(localPoint1)) {
      walkTile(paramRSTile);
      sleep(random(340, 1310));
    }

    try
    {
      for (int i = 0; i < 30; i++) {
        Point localPoint2 = this.calc.tileToScreen(paramRSTile, paramDouble1, paramDouble2, paramInt);
        if (!this.calc.pointOnScreen(localPoint2)) {
          return false;
        }
        if (this.menu.getItems().toString().toLowerCase().contains(paramString1.toLowerCase())) {
          break;
        }
        if (this.mouse.getLocation().equals(localPoint2)) {
          break;
        }
        this.mouse.move(localPoint2);
      }
      if (this.menu.getItems().length <= 1) {
        return false;
      }
      sleep(random(100, 200));
      if (this.menu.getItems().toString().toLowerCase().contains(paramString2.toLowerCase())) {
        this.mouse.click(true);
        return true;
      }
      return this.menu.doAction(paramString2);
    }
    catch (Exception localException) {
      localException.printStackTrace();
    }return false;
  }

  private void walkTile(RSTile paramRSTile)
  {
    if ((this.calc.distanceTo(this.walking.getDestination()) > random(4, 7)) && 
      (this.players.getMyPlayer().isMoving())) {
      return;
    }
    Point localPoint = this.calc.tileToScreen(paramRSTile);
    if (this.calc.pointOnScreen(localPoint)) {
      if (this.players.getMyPlayer().isMoving())
        return;
      this.mouse.move(localPoint, random(-3, 4), random(-3, 4));
      this.walking.walkTileOnScreen(paramRSTile);
      sleep(random(500, 750));
    } else {
      this.walking.walkTileMM(paramRSTile);
      sleep(random(500, 750));
    }
  }

  public void onFinish() {
    log("Thanks for using Voltrex Ape Atoll!");
  }

  public boolean logIn() {
    if (this.game.isWelcomeScreen()) {
      log("On Welcome Screen, logging in...");
      sleep(random(2000, 3500));
      this.interfaces.getComponent(18).doClick();
      log("Clicked on login... Now waiting...");
      sleep(random(5000, 7000));
      return true;
    }if (this.interfaces.getComponent(907).isValid()) {
      log("On Welcome Screen, logging in...");
      sleep(random(2000, 3500));
      this.interfaces.getComponent(18).doClick();
      log("Clicked on login... Now waiting...");
      sleep(random(5000, 7000));
      return true;
    }
    log("Not on welcome screen... Can't login from here...");

    return false;
  }

  public void drawMouse(Graphics paramGraphics)
  {
    if (this.normal != null) {
      double d1 = this.mouse.getLocation().getX() - 8.0D;
      double d2 = this.mouse.getLocation().getY() - 8.0D;
      double d3 = this.mouse.getPressLocation().getX() - 8.0D;
      double d4 = this.mouse.getPressLocation().getY() - 8.0D;
      if (System.currentTimeMillis() - this.mouse.getPressTime() < 400L) {
        paramGraphics.drawImage(this.clicked, (int)d3, (int)d4, null);
      }
      paramGraphics.drawImage(this.normal, (int)d1, (int)d2, null);
    }
  }

  public void onRepaint(Graphics paramGraphics)
  {
    long l3 = 0L;
    long l4 = 0L;

    long l1 = System.currentTimeMillis() - this.scriptStartTime;
    long l2 = l1 / 1000L;
    if (l2 >= 60L) {
      l3 = l2 / 60L;
      l2 -= l3 * 60L;
    }
    if (l3 >= 60L) {
      l4 = l3 / 60L;
      l3 -= l4 * 60L;
    }

    int i = this.skills.getPercentToNextLevel(16);
    int j = this.skills.getCurrentExp(16);
    int k = this.skills.getCurrentLevel(16);
    int m = j - this.startXP;
    int n = k - this.startLvl;
    int i1 = (int)(3600000.0D / l1 * this.laps);
    int i2 = (int)(3600000.0D / l1 * m);
    int i3 = (int)(4.7D * i);
    drawMouse(paramGraphics);

    paramGraphics.setColor(new Color(32, 0, 0, 175));
    paramGraphics.fillRect(23, 387, 470, 26);
    paramGraphics.setColor(new Color(108, 108, 108, 200));
    paramGraphics.fillRect(25, 389, 470, 26);

    paramGraphics.setColor(new Color(0, 0, 0, 175));
    paramGraphics.fillRoundRect(7, 345, 506, 129, 7, 7);

    paramGraphics.drawImage(this.BKG, 90, 10, null);
    paramGraphics.setColor(new Color(70, 50, 10, 255));
    paramGraphics.drawString("v" + this.properties.version(), 321, 40);

    paramGraphics.setColor(new Color(139, 0, 0, 175));
    paramGraphics.fillRect(24, 388, 470, 26);
    paramGraphics.setColor(new Color(0, 166, 0, 200));
    paramGraphics.fillRect(24, 388, i3, 26);

    paramGraphics.setColor(new Color(207, 58, 58, 175));
    paramGraphics.fillRect(24, 401, 470, 13);
    paramGraphics.setColor(new Color(128, 219, 128, 200));
    paramGraphics.fillRect(24, 401, i3, 13);

    paramGraphics.setFont(new Font("Verdana", 0, 14));
    paramGraphics.setColor(new Color(0, 0, 0, 255));
    paramGraphics.drawString(i + "% - " + this.skills.getExpToNextLevel(16) + "xp remaining", 43, 406);

    paramGraphics.setFont(new Font("Verdana", 0, 12));
    paramGraphics.setColor(new Color(225, 225, 225, 175));

    paramGraphics.drawString("Total Laps: " + this.laps + " (" + i1 + "/hr)", 24, 430);
    paramGraphics.drawString("Current Lvl: " + k + " (+ " + n + ")", 24, 445);
    paramGraphics.drawString("Exp Gained: " + m + " (" + i2 + "/hr)", 24, 460);

    paramGraphics.drawString("Status: " + this.status, 250, 430);
    paramGraphics.drawString("Run Time: " + l4 + ":" + l3 + ":" + l2, 250, 445);
    try {
      if (i2 > 0) {
        long l5 = this.skills.getExpToNextLevel(16) / (i2 / 3600);
        long l6 = l5 / 3600L;
        l5 -= l6 * 3600L;
        long l7 = l5 / 60L;
        l5 -= l7 * 60L;
        paramGraphics.drawString("Level in: " + l6 + ":" + l7 + ":" + l5 + " (" + i + "%)", 250, 460);
      } else {
        paramGraphics.drawString("Level in: 0:0:0 (" + i + "%)", 250, 460);
      }
    } catch (Exception localException) {
      paramGraphics.drawString("Level in: -1:-1:-1 (" + i + "%)", 250, 460);
    }
  }
}